package com.example.blog.service;

import com.example.blog.mapper.ArticleMapper;
import com.example.blog.model.Article;
import com.example.blog.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: chengbaiyi
 * @create: 2022-08-25 19:59
 */
@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    public List<Article> articleList(Integer cp, Integer ps) {
        return articleMapper.articleList(cp, ps);
    }

    public List<Article> myArticleList(Integer uid) {
        return articleMapper.myArticleList(uid);
    }

    public int addArticle(String title, String context, Integer uid) {
        return articleMapper.addArticle(title, context, uid);
    }

    public int addReadCount(Integer aid) {
        return articleMapper.addReadCount(aid);
    }

    public Article artDetail(Integer aid) {
        return articleMapper.artDetail(aid);
    }

    public int delArticle(Integer aid) {
        return articleMapper.delArticle(aid);
    }

    public int updateArticle(String title, String context, Integer aid, Integer uid) {
        return articleMapper.updateArticle(title, context, aid, uid);
    }

    public UserInfo getUserByAid(Integer aid) {
        return articleMapper.getUserByAid(aid);
    }

    public int getArticleCount(Integer aid) {
        return articleMapper.getArticleCount(aid);
    }
}
